package com.example.easyscript.config;


import com.example.easyscript.common.core.response.ResponseBodyHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 *  异常处理器自动配置
 */
@Configuration
@ConditionalOnClass(WebMvcConfigurer.class)
public class ResponseHandlerConfiguration {

    /**
     * 返回结果封装器
     */
    @Bean
    @ConditionalOnMissingBean(ResponseBodyHandler.class)
    public ResponseBodyHandler responseBodyHandler() {
        return new ResponseBodyHandler();
    }

}
